package View;

import com.icss.dao.DeptFileDao;
import com.icss.dao.IDeptFileDao;
import com.icss.entity.Dept;
import java.util.Scanner;

public class MainFileView{
    Scanner scanner = null;
    IDeptFileDao deptFileDao;
    {
        deptFileDao = new DeptFileDao();
    }

    public static void main(String[] args) {
        MainFileView mainFileView = new MainFileView();
        mainFileView.topView();
    }
    /*
     *首页
     */
    private void topView(){
        System.out.println( " 欢迎使用人力资源管理系统 " );
        System.out.println( "===============================" );
        System.out.println( " 部门管理--------------------1" );
        System.out.println( " 员工管理--------------------2" );
        System.out.println( " 程序退出--------------------3" );

        scanner = new Scanner( System.in );
        int choice = scanner.nextInt();
        switch (choice){
            case 1:
                deptView();
                break;
            case 2:

                break;
            case 3:
                System.exit( 0 );
                break;
        }
    }
    /*
     *部门管理
     */
    private void deptView() {
        System.out.println( "===============================" );
        System.out.println( " 添加部门--------------------1" );
        System.out.println( " 修改部门--------------------2" );
        System.out.println( " 删除部门--------------------3" );
        System.out.println( " 查询所有部门----------------4" );
        System.out.println( " 返回首页--------------------5" );
        int choice = scanner.nextInt();

        switch (choice){
            case 1:
                addDeptView();
//                adddept();
                break;
            case 2:

                break;
            case 3:

                break;
            case 4:

                break;
            case 5:
                topView();
                break;
        }
    }

    /*
     *添加部门视图
     */
    private void addDeptView() {
        System.out.println( "请输入部门编号：" );
        int deptNo = scanner.nextInt();
        System.out.println("请输入部门名称：");
        String deptName = scanner.next();
        System.out.println("请输入部门地址：");
        String deptLoc = scanner.next();
        Dept dept = new Dept( deptNo,deptName,deptLoc );
        deptFileDao.write( dept );
        System.out.println("添加成功！");

    }
}